<script setup>
import {ref} from 'vue'
const loading=ref(false)

const detail_rest=ref([
	{name:"绿野轻食坊",tip:"专注于低盐低糖的健康餐食，提供多种适合老年人的营养套餐，食材新鲜，烹饪方式健康。",distance:"1.2km",rate:"4.5",special:['低盐','低糖','高纤维']},
	{name:"养生粥铺",tip:"提供各种养生粥品和小菜，特别适合消化功能较弱的老年人，粥品熬制时间长，营养易吸收。",distance:"1.5km",rate:"4.8",special:['易消化','营养粥','药膳']}
])

//加载数据
const handleLoadData=()=>{
	uni.showLoading({
		title:'加载中'
	})
	setTimeout(()=>{
		uni.hideLoading();	
		 uni.showToast({
		            title: '加载成功',
		            icon: 'success',
		            duration: 1500
		        });
	},1000)
		
}

</script>
<template>
	<view class="food-container">
		<!--健康数据同步-->
		<view class="title">
			<image src="/static/health.png" class="icon"></image>
			<view class="text">健康数据同步</view>
		</view>
		<view class="core-function">
			<view class="func-item">
				<view class="connection">
					<view class="img">
						<image src="/static/bluetooth.png"></image>
					</view>
					<view class="is">已连接</view>
					<view class="model">-华为手环4-最后同步时间：</view>
					<view class="time">2分钟前</view>
				</view>
				<view class="data-box">
					<view class="rate">
						<view class="num">72</view>
						<view class="text">心率</view>
						<view v-if="true" class="dot"></view>
					</view>

					<view class="stress">

						<view class="num">120/80</view>
						<view class="text">血压</view>
						<view v-if="true" class="special-dot dot"></view>
					</view>
					<view class="Oxy">
						<view class="num">98%</view>
						<view class="text">血氧</view>
						<view v-if="true" class="dot"></view>
					</view>
				</view>
				<view @tap="handleLoadData" class="data-refresh"><button><uni-icons color="white" type="refreshempty"
							size="12"></uni-icons><text>立即同步数据</text></button></view>
			</view>

		</view>
		<!--饮食建议-->
		<view class="title">
			<image src="/static/food.png" class="icon"></image>
			<view class="text">个性化食谱推荐</view>
		</view>
		<view class="food-detail">
			<!--早餐-->
			<view class="breakfast">
				<view class="item">
					<image src="/static/breakfast.png"></image>
					<view class="text">早餐</view>
				</view>
				<view class="tip">燕麦粥1碗，水煮蛋1个，苹果半个低脂低糖，富含膳食纤维</view>
			</view>
			<!--午餐-->
			<view class="lunch">
				<view class="item">
					<image src="/static/lunch.png"></image>
					<view class="text">午餐</view>
				</view>
				<view class="tip">糙米饭1小碗，清蒸鱼150g，西兰花100g优质蛋白，控制盐分摄入</view>
			</view>
			<!--晚餐-->
			<view class="dinner">
				<view class="item">
					<image src="/static/dinner.png"></image>
					<view class="text">晚餐</view>
				</view>
				<view class="tip">小米粥1碗，蒸南瓜100g，凉拌木耳50g易消化，富含微量元素</view>
			</view>
		</view>
		<!--附近健康餐厅推荐-->
		<view class="title">
			<image src="/static/restaurant.png" class="icon"></image>
			<view class="text">附近健康餐厅推荐</view>
		</view>
		<view class="rest-detail">
			<view v-for="item in detail_rest" :key="item.name" class="item">
				<view  class="name">
					<image src="/static/hospital2.png" ></image>
					<view class="name">{{item.name}}</view>
				</view>
				<view class="tip">
					<view class="distance">
						<uni-icons color="black" type="location-filled"size="15"></uni-icons>
						<text>距离：{{item.distance}}</text>
					</view>
					<view class="rate">
						<uni-icons color="black" type="star-filled"size="15"></uni-icons>
						<text>评分：{{item.rate}}</text>
					</view>
				</view>
				<view class="detail">{{item.tip}}</view>
				<view class="special">
					<view v-for="i in item.special" class="spe-item">
						{{i}}
					</view>
				</view>
			</view>
		</view>

	</view>

</template>



<style lang="scss" scoped>
	//餐厅详情
	.rest-detail{
		.item{
			height: 250rpx;
			margin: 20rpx auto;
			border-radius: 15rpx;
			border: 1px solid #eee;
			box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
			width: 85%;
			padding: 30rpx 20rpx;
			.name{
				display: flex;
				image{
					width: 31rpx;
					height: 31rpx;
				}
				.name{
					font-size: 26rpx;
					margin-left: 15rpx;
					color:  rgb(105, 145, 196);
					font-weight: 700;
				}
			}
			.tip{
				margin-top: 15rpx;
				display: flex;
				justify-content: space-between;
				font-size: 22rpx;
			}
			.detail{
				margin-top: 15rpx;
				letter-spacing: 2rpx;
				font-size: 22rpx;
			}
			.special{
				margin-top: 20rpx;
				display: flex;
				
				.spe-item{
					margin-left: 20rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					width: 81rpx;
					height: 41rpx;
					background-color: rgb(212,225,244);
					border-radius: 10rpx;
					font-size: 22rpx;
					color: rgb(128, 147, 182);
				}
			}
		}
	}
	.food-detail {

		height: 500rpx;
		margin: 20rpx auto;
		border-radius: 15rpx;
		border: 1px solid #eee;
		box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
		width: 85%;
		padding: 30rpx 20rpx;

		.breakfast,
		.lunch,
		.dinner {
			margin-bottom: 60rpx;
		}

		.item {
			display: flex;
			align-items: center;

			image {
				width: 35rpx;
				height: 35rpx;
			}

			.text {
				margin-left: 10rpx;
				color: rgb(105, 145, 196);
				font-weight: 700;
				font-size: 24rpx;
			}
		}

		.tip {
			margin: 20rpx 20rpx;
			margin-left: 55rpx;
			width: 75%;
			font-size: 26rpx;
		}
	}

	.data-refresh button {

		border-radius: 20rpx;
		border: none;
		background-color: rgb(106, 144, 201);
		color: white;
		font-size: 22rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		text {
			margin-left: 5rpx;
		}

	}

	.food-container {
		padding: 20rpx;

		.data-box {
			width: 550rpx;
			height: 200rpx;
			margin: 30rpx auto;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border: 1px solid #eee;
			box-shadow: -8rpx 0 12rpx -2rpx rgba(0, 0, 0, 0.1);
			border-radius: 10rpx;

			.dot {
				position: absolute;
				margin-top: -120rpx;
				margin-left: 120rpx;
				width: 14rpx;
				height: 14rpx;
				border-radius: 50%;
				background-color: rgb(80, 182, 90);
			}

			.special-dot {
				margin-left: 170rpx;
			}

			.num {
				color: rgb(106, 144, 201);
				font-weight: 700;
				font-size: 35rpx;
			}

			.text {
				margin-top: 17rpx;
				font-size: 23rpx;
			}

			.rate,
			.Oxy {
				flex-direction: column;
				display: flex;
				justify-content: center;
				text-align: center;
				width: 25%;
				background-color: rgb(249, 249, 249);
				height: 150rpx;
				border-radius: 10rpx;
				margin: 0 20rpx;
			}

			.stress {
				flex-direction: column;
				display: flex;
				justify-content: center;
				text-align: center;
				width: 35%;
				background-color: rgb(249, 249, 249);
				height: 150rpx;
				border-radius: 10rpx;
			}

		}

		.title {
			display: flex;
			align-items: center;

			image {
				width: 50rpx;
				height: 50rpx;

			}

			.text {
				margin-left: 15rpx;
				color: rgb(106, 144, 201);
				font-weight: 600;
				font-size: 32rpx;
				letter-spacing: 1rpx;
			}
		}

		.core-function {
			margin-top: 20rpx;

			.func-item {
				margin: 20rpx auto;
				width: 85%;
				height: 400rpx;
				border: 1px solid #eee;
				box-shadow: -8rpx 0 12rpx -2rpx rgba(80, 182, 90, 0.6);
				border-radius: 10rpx;
				padding: 30rpx;

				.connection {
					display: flex;
					align-items: center;
					font-size: 26rpx;
					letter-spacing: 2rpx;

					image {
						width: 51rpx;
						height: 51rpx;
						margin-right: 20rpx;
					}

					.is {
						font-weight: 700;
						color: rgb(80, 182, 90);

					}
				}
			}
		}
	}
</style>